# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=sonivox
pkgver=3.6.12
pkgrel=1
pkgdesc="Fork of the AOSP 'platform_external_sonivox' to use outside of Android"
arch=(loong64 x86_64)
url="https://github.com/pedrolcl/sonivox"
license=(Apache)
depends=(glibc)
makedepends=(cmake gtest)
provides=(libsonivox.so)
source=($pkgname-$pkgver.tar.gz::https://github.com/pedrolcl/$pkgname/archive/refs/tags/v$pkgver.tar.gz)
sha256sums=('23a7f29c617e791dfcb50b75eef41464e4bf3fca15b19da395a64373ff5d8456')
b2sums=('4a264474eb640dc3a335292c16bca74d942d096e3b74dd566dd9c5218417e71d8b4226342cf634f95a3bb9d624a0deb4e159b4ce03b95907a5b662708fcffc6b')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
